﻿using System;
using Character;
using UnityEngine;
using UnityEngine.Events;

// Token: 0x02000275 RID: 629
public class H_CharaMoveController : CharaMoveController
{
	// Token: 0x06001072 RID: 4210 RVA: 0x0006895C File Offset: 0x00066B5C
	protected override void Awake()
	{
		base.Awake();
		this.switchRoot.action.AddListener(new UnityAction<int>(this.ChangeTrans));
	}

	// Token: 0x06001073 RID: 4211 RVA: 0x00068980 File Offset: 0x00066B80
	public void Setup(H_Scene h_scene)
	{
		this.h_scene = h_scene;
		this.SetNameUI();
		this.invoke = false;
		this.speedSlider.SetValue(this.speedRate);
		this.invoke = true;
		this.ChangeTrans(0, false);
	}

	// Token: 0x06001074 RID: 4212 RVA: 0x000689B8 File Offset: 0x00066BB8
	public void SetNameUI()
	{
		bool flag = this.h_scene.visitor != null;
		if (this.switchRoot != null)
		{
			this.switchRoot.gameObject.SetActive(flag);
		}
		if (flag)
		{
			string text = Female.HeroineName(this.h_scene.mainMembers.GetFemale(0).HeroineID);
			this.toggleFemale.SetText(text, text);
			string text2 = string.Empty;
			if (this.h_scene.visitor.GetHuman().sex == SEX.FEMALE)
			{
				Female female = this.h_scene.visitor.GetHuman() as Female;
				text2 = Female.HeroineName(female.HeroineID);
			}
			else
			{
				Male male = this.h_scene.visitor.GetHuman() as Male;
				text2 = Male.MaleName(male.MaleID);
			}
			this.toggleVisitor.SetText(text2, text2);
		}
	}

	// Token: 0x06001075 RID: 4213 RVA: 0x00068AA0 File Offset: 0x00066CA0
	private void Update()
	{
		if (this.h_scene.visitor != null)
		{
			this.toggleVisitor.Interactable = !this.h_scene.visitor.LockPos;
			if (this.target == CharaMoveController.TARGET.VISITOR && this.h_scene.visitor.LockPos)
			{
				this.switchRoot.Change(0, false);
				this.ChangeTrans(0, false);
			}
		}
	}

	// Token: 0x06001076 RID: 4214 RVA: 0x00068B14 File Offset: 0x00066D14
	public void ChangeTrans()
	{
		this.ChangeTrans((int)this.target, false);
	}

	// Token: 0x06001077 RID: 4215 RVA: 0x00068B24 File Offset: 0x00066D24
	private void ChangeTrans(int no)
	{
		this.ChangeTrans(no, true);
	}

	// Token: 0x06001078 RID: 4216 RVA: 0x00068B30 File Offset: 0x00066D30
	private void ChangeTrans(int no, bool se)
	{
		if (se)
		{
			SystemSE.Play(SystemSE.SE.CHOICE);
		}
		PosYaw lastPosYaw;
		if (no == 0)
		{
			this.moveTrans = this.h_scene.mainMembers.Transform;
			this.target = CharaMoveController.TARGET.MAIN;
			lastPosYaw = this.h_scene.mainMembers.GetLastPosYaw();
		}
		else
		{
			this.moveTrans = this.h_scene.visitor.GetHuman().transform;
			this.target = CharaMoveController.TARGET.VISITOR;
			lastPosYaw = this.h_scene.visitor.GetLastPosYaw();
		}
		Vector3 pos = Vector3.zero;
		Quaternion rot = Quaternion.identity;
		if (lastPosYaw != null)
		{
			pos = lastPosYaw.pos;
			rot = Quaternion.Euler(0f, lastPosYaw.yaw, 0f);
		}
		base.SetDef(pos, rot);
	}

	// Token: 0x06001079 RID: 4217 RVA: 0x00068BF0 File Offset: 0x00066DF0
	public void Button_NextMapPos()
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		if (this.target == CharaMoveController.TARGET.MAIN)
		{
			this.h_scene.NextMapPos_MainMember();
		}
		else
		{
			this.h_scene.NextMapPos_Visitor();
		}
		base.SetDef(this.moveTrans.position, this.moveTrans.rotation);
	}

	// Token: 0x0600107A RID: 4218 RVA: 0x00068C48 File Offset: 0x00066E48
	public void Button_PrevMapPos()
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		if (this.target == CharaMoveController.TARGET.MAIN)
		{
			this.h_scene.PrevMapPos_MainMember();
		}
		else
		{
			this.h_scene.PrevMapPos_Visitor();
		}
		base.SetDef(this.moveTrans.position, this.moveTrans.rotation);
	}

	// Token: 0x0400118F RID: 4495
	[SerializeField]
	protected RadioButtonGroup switchRoot;

	// Token: 0x04001190 RID: 4496
	[SerializeField]
	protected ToggleButton toggleFemale;

	// Token: 0x04001191 RID: 4497
	[SerializeField]
	protected ToggleButton toggleVisitor;

	// Token: 0x04001192 RID: 4498
	protected H_Scene h_scene;

	// Token: 0x04001193 RID: 4499
	protected CharaMoveController.TARGET target;
}
